package d0316;


import java.util.zip.DataFormatException;

public class Employee {
    private String name;
    private  int salary;

    public Employee(){

    }

    public Employee(String name,int salary){
        this.name = name;
        this.salary = salary;
    }

    public void setSalary(int salary) throws DataFormatException {
        if (salary<=2000){
            throw new DataFormatException("薪资不饿能低于2000");
        }
        this.salary = salary;
    }

    public static void main(String[] args) {
        Employee employee = new Employee();
        try {
            employee.setSalary(3000);
        } catch (DataFormatException e) {
            e.printStackTrace();
        }
    }
}